package flow

import (
	"fmt"

	"openmanus/agent"
	"openmanus/tool"
)

// FlowFactory 流程工厂接口
type FlowFactory interface {
	CreateFlow(agents map[string]agent.IBaseAgent) (Executor, error)
}

// DefaultFlowFactory 默认流程工厂实现
type DefaultFlowFactory struct{}

// NewDefaultFlowFactory 创建默认流程工厂
func NewDefaultFlowFactory() *DefaultFlowFactory {
	return &DefaultFlowFactory{}
}

// CreateFlow 创建流程
func (f *DefaultFlowFactory) CreateFlow(agents map[string]agent.IBaseAgent, tools *tool.ToolCollection, llmClient *agent.LLMClient) (Executor, error) {
	if agents == nil {
		return nil, fmt.Errorf("agents 不能为空")
	}
	return NewPlanningFlow(agents, tools, llmClient), nil
}
